Imports System.ComponentModel
Imports Aricie.DNN.UI.Attributes
Imports Aricie.DNN.ComponentModel
Imports Aricie.DNN.UI.WebControls.EditControls
Imports DotNetNuke.UI.WebControls
Imports System.Web.UI.WebControls
Imports Aricie.DNN.Services
Imports System.IO
Imports Aricie.DNN.Modules.LuceneSearch.Business
Imports Aricie.DNN.Modules.LuceneSearch.ModuleProviders
Imports System.Xml.Serialization
Imports Aricie.Collections

Namespace Aricie.DNN.Modules.LuceneSearch.Settings

    <Serializable()> _
    Public Class LuceneSearchConfig
        Inherits AutoModuleConfig(Of LuceneSearchConfig)

        Private _Providers As New SerializableList(Of LuceneProviderConfig)
        <NonSerialized()> _
        Private _ProviderFactory As ProviderFactory


        <Category("Providers")> _
        <Editor(GetType(ListEditControl), GetType(EditControl))> _
        <CollectionEditor(False, False, True, True, 5)> _
        <LabelMode(LabelMode.Top)> _
        Public Property Providers() As SerializableList(Of LuceneProviderConfig)
            Get
                Return _Providers
            End Get
            Set(ByVal value As SerializableList(Of LuceneProviderConfig))
                _Providers = value
            End Set
        End Property

        <XmlIgnore()> _
        <Browsable(False)> _
        Public ReadOnly Property ProviderFactory() As ProviderFactory
            Get
                If _ProviderFactory Is Nothing Then
                    _ProviderFactory = New ProviderFactory
                End If
                Return _ProviderFactory
            End Get
        End Property


        Public Overrides Function GetDefaultConfig() As LuceneSearchConfig
            Dim toReturn As LuceneSearchConfig = MyBase.GetDefaultConfig()
            toReturn.Providers.Add(ProviderConfigHelper(Of LuceneProviderConfig).GetNew("DefaultFieldGlossary", "this is the default Glossary with main global and DNN fields", GetType(DefaultFieldGlossary)))

            Return toReturn
        End Function

#Region "IModuleIdentity"

        Public Overrides Function GetModuleName() As String
            Return Aricie.DNN.Modules.LuceneSearch.Common.Constants.ModuleNameLuceneSearchResults
        End Function

#End Region



    End Class

End Namespace

